package me.ydq.core.sql;

import me.ydq.core.SqlSpec;
import me.ydq.misc.Fn;

import java.util.function.Supplier;

public interface SqlNotBetween<T> {

    SqlSpec<T> notBetween(Fn<T, ?> fn, Object from, Object to);

    SqlSpec<T> notBetween(String column, Object from, Object to);

    default SqlSpec<T> notBetween(Supplier<Boolean> condition, Fn<T, ?> fn, Object from, Object to) {
        return notBetween(Boolean.TRUE.equals(condition.get()), fn, from, to);
    }

    default SqlSpec<T> notBetween(boolean condition, Fn<T, ?> fn, Object from, Object to) {
        return condition ? notBetween(fn, from, to) : (SqlSpec<T>) this;
    }

    default SqlSpec<T> notBetween(Supplier<Boolean> condition, String rawColumn, Object from, Object to) {
        return notBetween(Boolean.TRUE.equals(condition.get()), rawColumn, from, to);
    }

    default SqlSpec<T> notBetween(boolean condition, String rawColumn, Object from, Object to) {
        return condition ? notBetween(rawColumn, from, to) : (SqlSpec<T>) this;
    }
}
